﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Shapes;
using System.Windows.Threading;
using System.ComponentModel;


namespace OperGui
{
    public class Timecontrol : INotifyPropertyChanged
    {
        #region field
        DispatcherTimer Ctimer;
        public string Ctime;
        public string OWT = "00:00:10";
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

        #region constructor
        public Timecontrol()
        {
            Ctimer = new DispatcherTimer();
            Ctimer.Interval = TimeSpan.FromSeconds(1.0);
            Ctimer.Start();
            Ctimer.Tick += new EventHandler(delegate(object s, EventArgs a)
            {

                Thistime = "" + DateTime.Now.Hour + ":" +
                    DateTime.Now.Minute + ":" + DateTime.Now.Second + "   " + DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year;
            });
        }
        #endregion

        protected void NotifyPropertyChanged(String propertyName)
        {
            if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }


        //Current time
        public string Thistime
        {
            get { return Ctime; }
            set
            {
                Ctime = value;
                NotifyPropertyChanged("Thistime");
            }
        }

        public string OneWayTime
        {
            get { return OWT; }
            set
            {
                OneWayTime = value;
                NotifyPropertyChanged("OneWayTime");
            
            }
        
        
        
        }
    }
}


